#!/usr/bin/env python
# Translate English word to Hebrew using http://www.babylon.com

# Author: Miki Tebeka <miki.tebeka@gmail.com>
# Copyright: BSD (see LICENSE)

import webbrowser

URL_TEMPLATE = "http://www.babylon.com/definition/%s/Hebrew"

def main(argv = None):
    if argv is None:
        import sys
        argv = sys.argv

    from optparse import OptionParser

    parser = OptionParser("usage: %prog WORD")

    opts, args = parser.parse_args(argv[1:])
    if len(args) != 1:
        parser.error("wrong number of arguments") # Will exit

    word = args[0]

    url = URL_TEMPLATE % word
    webbrowser.open(url)

if __name__ == "__main__":
    main()

